package com.dc.commons.persistence;

import java.util.Date;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.MappedSuperclass;

import com.dc.commons.annotation.DcComment;
import com.dc.commons.jpa.listeners.AuditJpaListener;
import com.dc.commons.persistence.able.AuditAble;
import com.dc.commons.persistence.embeddable.Data;
import com.dc.commons.persistence.embeddable.Member;
import com.dc.commons.status.AuditStatus;

/*******************************************************************************<P>
 * 文件名: AuditEntity.java <br>
 * 版本: 1.0<br>
 * 描述:<br>
 * 版权所有: <br>
 * <P>
 * 创建者: 王建栋 <br>
 * 创建日期: 2015年12月22日 上午12:01:41<br>
 * 修改者: <br>
 * 修改日期: <br>
 * 修改说明: <br>
 ******************************************************************************/
@MappedSuperclass
@EntityListeners({AuditJpaListener.class})
public abstract class AuditEntity extends OperatorEntity implements AuditAble{

	/**
	 * 审核人
	 */
	private Member auditKey;
	/**
	 * 审核日期
	 */
	private Date auditDate;
	/**
	 * 审核状态
	 */
	private AuditStatus auditStatus;
	/**
	 * 审核备注
	 */
	private Data auditNote;
	
	

	/* (non-Javadoc)
	 * @see com.dc.commons.persistence.able.AuditAble#getAuditKey()
	 */
	@AttributeOverrides({
		@AttributeOverride(name=Member.CODE,column=@Column(name="AUDIT_KEY",length=50))
	})
	@Override
	public Member getAuditKey() {
		return this.auditKey;
	}

	/* (non-Javadoc)
	 * @see com.dc.commons.persistence.able.AuditAble#setAuditKey(com.dc.commons.persistence.embeddable.Persion)
	 */
	@Override
	public void setAuditKey(Member auditKey) {
		this.auditKey=auditKey;
	}

	/* (non-Javadoc)
	 * @see com.dc.commons.persistence.able.AuditAble#getAuditDate()
	 */
	@Override
	public Date getAuditDate() {
		return this.auditDate;
	}

	/* (non-Javadoc)
	 * @see com.dc.commons.persistence.able.AuditAble#setAuditDate(java.util.Date)
	 */
	@Override
	public void setAuditDate(Date auditDate) {
		this.auditDate=auditDate;
	}

	/* (non-Javadoc)
	 * @see com.dc.commons.persistence.able.AuditAble#getAuditStatus()
	 */
	@Override
	@Enumerated(EnumType.STRING)
	public AuditStatus getAuditStatus() {
		return this.auditStatus;
	}

	/* (non-Javadoc)
	 * @see com.dc.commons.persistence.able.AuditAble#setAuditStatus(com.dc.commons.status.AuditStatus)
	 */
	@Override
	public void setAuditStatus(AuditStatus auditStatus) {
		this.auditStatus=auditStatus;
	}

	/* (non-Javadoc)
	 * @see com.dc.commons.persistence.able.AuditAble#getAuditNote()
	 */
	@AttributeOverrides({
   		@AttributeOverride(name=Data.DATA,column=@Column(name="AUDIT_NOTE",length=50))
   	})
	@DcComment("审核备注")
	@Override
	public Data getAuditNote() {
		return this.auditNote;
	}

	/* (non-Javadoc)
	 * @see com.dc.commons.persistence.able.AuditAble#setAuditNote(com.dc.commons.persistence.embeddable.Data)
	 */
	@Override
	public void setAuditNote(Data auditNote) {
		this.auditNote=auditNote;
	}

}
